import httpRequest from '../../utils/request'
import modules from '../modules'
const defaultRoute = 'Production_ProductionTask'
const controllerName = 'ProductionTask'

export interface ProductionParam {
  ProductionTaskName: string | null
  PageIndex: number
  PageSize: number
  totalCount: number
}


// 获取生产任务列表
export function ApiGetProduction_ProductionTaskPageListAsync(param: ProductionParam) {
  return httpRequest({
    url: `${modules.ProductionModuleUrl}/${controllerName}/Get${defaultRoute}PageList`,
    method: "Post",
    data: param,
  });
}

// 批量删除生产任务
export function ApiDeletionProduction_ProductionTaskAsync(param: string[]) {
  return httpRequest({
    url: `${modules.ProductionModuleUrl}/${controllerName}/Deletion${defaultRoute}`,
    method: "Post",
    data: param,
  });
}


// 添加生产任务
export function ApiCreateProduction_ProductionTaskAsync(param: object) {
  return httpRequest({
    url: `${modules.ProductionModuleUrl}/${controllerName}/Create${defaultRoute}`,
    method: "Post",
    data: param,
  });
}


// 更新生产任务
export function ApiUpdateProduction_ProductionTaskAsync(param: object) {
  return httpRequest({
    url: `${modules.ProductionModuleUrl}/${controllerName}/Update${defaultRoute}`,
    method: "Post",
    data: param,
  });
}

// 根据生产任务id获取工单信息
export function ApiGetProduction_ProductionTaskByIdAsync(param: string) {
  return httpRequest({
    url: `${modules.ProductionModuleUrl}/${controllerName}/Get${defaultRoute}ById`,
    method: "Post",
   data: {
      ProductionTaskId:param
    },
  });
}

// 根据生产任务id分解生产任务
export function ApiGetProduction_ProductionTaskByIdTaskListAsync(param: string) {
  return httpRequest({
    url: `${modules.ProductionModuleUrl}/${controllerName}/Get${defaultRoute}ByIdTaskList`,
    method: "Post",
   data: {
      ProductionTaskId:param
    },
  });
}

// 根据计划明细id添加生产任务（单）
export function ApiCreateProduction_ProductionTaskBySchedulingPlanDetialIdAsync(param: object) {
  return httpRequest({
    url: `${modules.ProductionModuleUrl}/${controllerName}/Create${defaultRoute}BySchedulingPlanDetialId`,
    method: "Post",
    data: param,
  });
}
